﻿using System.Collections.Generic;
using System.Linq;

namespace SalesCore.Data
{
    /// <summary>
    /// Repository Interface
    /// </summary>
    public interface IRepository<T> where T : class
    {
        IQueryable<T> Table { get; }

        IQueryable<TTable> GetTable<TTable>() where TTable : class;

        int Count();

        bool Delete(T entity);

        //void Delete<TNavigation>(T entity, Expression<Func<T, IEnumerable<TNavigation>>> expression) where TNavigation : class;

        void DeleteMany(IEnumerable<T> entities);

        T GetById(object id);

        void Insert(T entity);

        void InsertMany(IEnumerable<T> entities);

        void Update(T entity);

        void UpdateMany(IEnumerable<T> entities);

        //void UpdateMany(Expression<Func<T, bool>> filterExpression, Expression<Func<T, T>> updateExpression);

        IEnumerable<T> ExecuteStoredProcedure(string commandText, params object[] parameters);

        T Attach(T entity);
    }
}